
class game.Common{   

	
	
	static function GetNode(theNodeName:String, node:XMLNode):XMLNode{
		for (var i:Number=-1;++i<node.childNodes.length;){
			if (node.childNodes[i].nodeName == theNodeName){
				return node.childNodes[i];
			}
		}
	}
		
	private static function getIndexByValue(_object:Object, _array:Array):Number {
		for (var i:Number = 0; i< _array.length; i++) {
			if (_array[i].mc == _object.mc) {
				return i;
			}
		}
		return -1;
	}
	
	static function removeMeFrom(_object:Object, collection:Array) {
	   var index:Number;
		if ((index = getIndexByValue(_object, collection)) != -1) {
		collection.splice(index, 1);
		}
	
	}
	
	static function removeMeFrom2(_object:Object, collection:Array) {
	   var index:Number;
		if ((index = getIndexByValue2(_object, collection)) != -1) {
		collection.splice(index, 1);
		}
	
	}
	
	private static function getIndexByValue2(_object:Object, _array:Array):Number {
		for (var i:Number = 0; i< _array.length; i++) {
			if (_array[i] == _object) {
				return i;
			}
		}
		return -1;
	}
	

}
